package com.yq.netty.nio;

import java.io.RandomAccessFile;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;

/**
 * @ClassName MapperByteBufferTest
 * @Description TODO
 * @Author yaoqiang
 * @Date 2021/3/24 14:13
 * @Version 1.0
 */
public class MapperByteBufferTest {
    public static void main(String[] args) throws  Exception {
        RandomAccessFile randomAccessFile = new RandomAccessFile("src/main/java/com/yq/netty/nio/1.txt","rw");
        FileChannel channel = randomAccessFile.getChannel();
        MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_WRITE, 0, 4);
        map.put(0,(byte) 'H');
        randomAccessFile.close();
    }
}
